/*
 * @lc app=leetcode.cn id=485 lang=cpp
 *
 * [485] 最大连续 1 的个数
 */

// @lc code=start

// #include <iostream>
// #include <vector>
// using namespace std;

class Solution {
   public:
    int findMaxConsecutiveOnes(vector<int>& nums) {
        int maxLength = 0, curLength = 0;

        for (int num : nums) {
            curLength = (num == 1) ? curLength + 1 : 0;
            maxLength = (curLength > maxLength) ? curLength : maxLength;
        }

        return maxLength;
    }
};
// @lc code=end
